package com.example.doctor.controller;

import com.example.common.support.Result;
import com.example.doctor.dto.req.NoticeListReq;
import com.example.doctor.dto.req.WcJsapiTicket;

import com.example.doctor.dto.resp.HDoctorNoticeRsp;
import com.example.doctor.dto.resp.TodayDateRsp;
import com.example.doctor.service.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author sifan
 * @PackagName:com.example.doctor.controller
 * @ClassName: IndexController
 * @Description:
 * @date:2021/1/19 13:15
 */
@RestController
@Api(tags = "医生端首页相关")
@RequestMapping("/api/Index")
public class IndexController {

    @Resource
    IndexService indexService;

    @ApiOperation(value = "首页统计")
    @PostMapping("/TodayDate")
    public Result<TodayDateRsp> TodayDate(){
        TodayDateRsp todayDateRsp = indexService.TodayDate();
        return Result.success(todayDateRsp);
    }

    @ApiOperation(value = "医院公告列表")
    @PostMapping("/NoticeList")
    public Result<Map<String,Object>> NoticeList(@RequestBody NoticeListReq noticeListReq){
        Map<String,Object> pageInfo = indexService.NoticeList(noticeListReq);
        return Result.success(pageInfo);
    }

    @ApiOperation(value = "微信JsTicket签名")
    @PostMapping("/WcJsapiTicket")
    public Result<WxJsapiSignature> WcJsapiTicket(@RequestBody WcJsapiTicket wcJsapiTicket){
        WxJsapiSignature wxJsapiSignature = indexService.WcJsapiTicket(wcJsapiTicket);
        return Result.success(wxJsapiSignature);
    }

}
